#include <iostream>
#include <cstdio>
using namespace std;
char map[50][50];
int n, m;
int change[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int better = -1, bx, by;
void calc(int x, int y)
{
    int cnt = 0;
    for (int t = 0; t < 4; t++)
    {
        int nx = x, ny = y;
        while (map[nx][ny] != '#')
        {
            nx = nx + change[t][0];
            ny = ny + change[t][1];
            if (map[nx][ny] == 'G')
                cnt++;
        }
    }
    if (cnt > better)
    {
        better = cnt;
        bx = x;
        by = y;
    }
}

void dfs(int x, int y)
{
    calc(x, y);
    for (int t = 0; t < 4; t++)
    {
        int nx = x + change[t][0];
        int ny = y + change[t][1];
        if (nx >= 0 && nx < n && ny >= 0 && ny < m && map[nx][ny] == '.')
        {
            map[nx][ny] = 'b';
            dfs(nx, ny);
        }
    }
}

int main()
{
    int sx, sy;
    cin >> n >> m >> sx >> sy;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> map[i][j];
        }
    }
    dfs(sx, sy);
    cout << bx << by << endl;
    cout << better << endl;

    return 0;
}